package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.entity.order.ImportErpWorkOrderDetail;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseErpIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseErpOrderListVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BasePageResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.Result;
import com.zmj.sy.mom.srv.aps.bean.vo.importerpmapping.ErpWorkOrderDetailResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.order.OrderErpMaintainVo;
import com.zmj.sy.mom.srv.aps.service.ErpWorkOrderDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@Api(tags = "ERP 工单维护")
@RestController
@RequestMapping("/erpWorkOrderDetail")
public class ErpWorkOrderDetailController {

    @Autowired
    private ErpWorkOrderDetailService erpWorkOrderDetailService;

    @ApiOperation("ERP工单维护 列表信息")
    @PostMapping("/list")
    public BasePageResVo<ErpWorkOrderDetailResVo> getErpOrder(@RequestBody BaseErpOrderListVo orderListVo) {
        return erpWorkOrderDetailService.getErpOrder(orderListVo);
    }

    @ApiOperation("根据ID查询ERP工单")
    @GetMapping("/get")
    public Result<ImportErpWorkOrderDetail> getOrderById(BaseErpIdReqVo reqVo) {
        ImportErpWorkOrderDetail erpOrder = erpWorkOrderDetailService.getOrderById(reqVo);

        return Result.success(erpOrder);
    }

    @ApiOperation("修改REP工单信息")
    @PostMapping("/edit")
    public Result<String> editOrder(@RequestBody OrderErpMaintainVo orderErpMaintainVo) {
        erpWorkOrderDetailService.editOrder(orderErpMaintainVo);
        return Result.success();
    }

}
